<template>
  <div class="header">
   <div class="header-logo" >
      <a>知乎</a>
   </div>
   <div class="box">
     <div class="box-list "><router-link to="/">首页</router-link></div>
     <div class="box-list active-nav"><a>问答</a></div>
     <div class="box-list"><a>专栏</a></div>
     <div class="box-list"><a>讲堂</a></div>
     <div class="box-list dropdown">
       <a>发现</a>
       <div class="dropdown-content">
         <a href="#"> 1</a>
         <a href="#"> 2</a>
         <a href="#"> 3</a>
       </div>
     </div>
   </div>
   <div>
      <div class="search-from">
        <input type="text" placeholder="请输入搜索关键字" value="" autofocus="autofocus" />
        <router-link to="/news/detail"><i class="iconfont icon-sousuo"></i></router-link>
      </div>
       <span @click="loginHandle" style="cursor: pointer">登录</span>
    </div>
      <login v-bind:isShowLogin="isShowLogin"></login>
  </div>
</template>

<script>
import AppDialog from '../Global/AppDialog'
import Login from '../Login/Login'

export default {
  name: 'PublicHeader',
  data () {
    return {
      header: 'this is a header',
      isShowLogin: false
    }
  },
  methods: {
    loginHandle: function () {
      this.isShowLogin = !this.isShowLogin
    }
  },
  components: {Login, AppDialog}
}
</script>

<style scoped>
.box-list {
  position: relative;
  float: left;
  width: 120px;
    height: 100px;
  /*padding: 0px 50px;*/
  cursor: pointer;
}
.box-list:hover{
  background-color: #009a61;
    color: white;
}
.box-list:hover>.dropdown-content{
    display: block;
}
.active-nav {
  /*background-color: #7d7d7d;*/
  color: #009a61;
  font-weight: 600;
}
.header {
  position: relative;
  top: 0px;
  width: 100%;
  min-height: 100px;
  line-height: 100px;
  border-top: 3px solid #009a61;
  background-color: #fafafa;
  box-shadow: 0px 2px 10px 0px rgba(0,0,0,0.3), 0 1px rgba(0,0,0,0.1)
}
.header-logo {
  float: left;
  margin-left: 40px;
  display: block;
}
 .search-from {
    position: relative;
    float: right;
    right: 20px;
    height: 30px;
    line-height: 100px;
  }
.search-from>input {
  height: 30px;
  font-size: medium;
  border:1px solid darkgray;
  border-radius: 8px;
  padding-left: 10px;
}
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-content {
    display: none;
    position: relative;
    background-color: #fafafa;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
    display:block;
    color: black;
    text-decoration: none;
    display: block;
}
.dropdown-content a:hover{
    color: black;
    background-color: #7d7d7d;
    padding: 12px 16px;
    display: block;
}
</style>
